package com.yf.simplejni;

import java.util.Arrays;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity {
	
	private Jni jni;

	static {
		System.loadLibrary("passparam");
	}

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        jni = new Jni();
    }
    
    
    public void passInt(View v) {
    	int sum = jni.sumByJni(3, 4);
    	Toast.makeText(this, String.valueOf(sum), Toast.LENGTH_SHORT).show();
    }
    
    public void passStr(View v) {
    	String str = jni.subStrByJni("abcdefg");
    	Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
    }
    
    public void passArr(View v) {
    	int[] sortedArr = jni.sortByJni(new int[]{7, 6, 2, 5, 3, 4});
    	System.out.println(Arrays.toString(sortedArr));
    }
}
